<div [@routerTransition]>
  <div class="m-subheader">
    <div class="d-flex align-items-center">
      <div class="mr-auto col-xs-6">
        <h3 class="m-subheader__title m-subheader__title--separator">
          <span>人员分配详细</span>
        </h3>
        <span class="m-section__sub"> 管理人员分配详细的文本头信息 </span>
      </div>
      <div class="col-xs-6 text-right"></div>
    </div>
  </div>
  <div class="m-content">
    <div class="m-portlet m-portlet--mobile">
      <div class="m-portlet__body">
        <div class="tabbable-line">
          <ul class="nav nav-tabs m-tabs-line">
            <li class="nav-item m-tabs__item">
              <button
                class="btn btn-primary blue"
                *ngFor="let v of tabs"
                (click)="tabTypeClick(v.label)"
              >
                {{ v.label }}
              </button>
            </li>
          </ul>
          <!-- <div style="width: 200px; display: inline-block; margin-bottom: 10px">
            <p-calendar
              [(ngModel)]="planDate"
              view="month"
              dateFormat="yy-mm"
              [showIcon]="true"
              name="planDate"
              [inputStyle]="{ width: '126px' }"
            ></p-calendar>
          </div> -->
          <div class="tab-content" style="padding-top: 0">
            <div class="tab-pane active" id="tab-model">
              <form class="horizontal-form" autocomplete="off">
                <div class="m-form m-form--label-align-right">
                  <div class="row align-items-center m--margin-bottom-10">
                    <div class="col-xl-12">
                      <div class="form-group m-form__group align-items-center">
                        <div class="input-group">
                          <input
                            [(ngModel)]="filterText"
                            name="filterText"
                            autofocus
                            class="form-control m-input"
                            [placeholder]="l('SearchWithThreeDot')"
                            type="text"
                          />
                          <span class="input-group-btn">
                            <button
                              (click)="getMonths()"
                              class="btn btn-primary"
                              type="submit"
                            >
                              <i
                                class="flaticon-search-1"
                                [attr.aria-label]="l('Search')"
                              ></i>
                            </button>
                          </span>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="row align-items-center m--margin-bottom-10">
                    <div class="col-md-6">
                      <div class="form-group">
                        <label for="StartEndRange" class="control-label">{{
                          l("DateRange")
                        }}</label>
                        <date-range-picker
                          id="StartEndRange"
                          [(startDate)]="startDate"
                          [(endDate)]="endDate"
                        ></date-range-picker>
                      </div>
                    </div>
                  </div>
                  <div
                    class="row margin-bottom-10"
                    *ngIf="advancedFiltersAreShown"
                  >
                    <div class="col-sm-12 text-right">
                      <button class="btn btn-metal" (click)="getMonths()">
                        <i class="fa fa-refresh"></i> {{ l("Refresh") }}
                      </button>
                    </div>
                  </div>
                  <div class="row margin-bottom-10">
                    <div class="col-sm-12">
                      <span
                        class="clickable-item text-muted"
                        *ngIf="!advancedFiltersAreShown"
                        (click)="
                          advancedFiltersAreShown = !advancedFiltersAreShown
                        "
                      >
                        <i class="fa fa-angle-down"></i>
                        {{ l("ShowAdvancedFilters") }}</span
                      >
                      <span
                        class="clickable-item text-muted"
                        *ngIf="advancedFiltersAreShown"
                        (click)="
                          advancedFiltersAreShown = !advancedFiltersAreShown
                        "
                      >
                        <i class="fa fa-angle-up"></i>
                        {{ l("HideAdvancedFilters") }}</span
                      >
                    </div>
                  </div>
                </div>
              </form>

              <div class="row align-items-center">
                <div
                  class="primeng-datatable-container"
                  [busyIf]="primengTableHelper.isLoading"
                >
                  <p-table
                    #dataTable
                    (onLazyLoad)="getMonths($event)"
                    [value]="primengTableHelper.records"
                    rows="{{ primengTableHelper.defaultRecordsCountPerPage }}"
                    [paginator]="false"
                    [lazy]="true"
                    emptyMessage="没有数据"
                    scrollable="true"
                    ScrollWidth="100%"
                    responsive="primengTableHelper.isResponsive"
                    resizableColumns="primengTableHelper.resizableColumns"
                    class="toolready"
                  >
                    <ng-template pTemplate="header">
                      <tr>
                        <th style="width: 100px" pSortableColumn="taskCode">
                          任务号
                          <p-sortIcon field="taskCode"></p-sortIcon>
                        </th>
                        <th style="width: 100px" pSortableColumn="taskName">
                          任务名称
                          <p-sortIcon field="taskName"></p-sortIcon>
                        </th>
                        <th style="width: 100px" pSortableColumn="drawingCode">
                          图号
                          <p-sortIcon field="drawingCode"></p-sortIcon>
                        </th>
                        <th style="width: 100px" pSortableColumn="modelCode">
                          型号
                          <p-sortIcon field="modelCode"></p-sortIcon>
                        </th>
                        <th
                          style="width: 100px"
                          pSortableColumn="amountPlanned"
                        >
                          投产数量
                          <p-sortIcon field="amountPlanned"></p-sortIcon>
                        </th>
                        <th style="width: 100px" pSortableColumn="actName">
                          节点名称
                          <p-sortIcon field="actName"></p-sortIcon>
                        </th>
                        <th style="width: 150px" pSortableColumn="userNames">
                          指定人员
                          <!-- <p-sortIcon field="taskName"></p-sortIcon> -->
                        </th>
                        <th style="width: 100px" pSortableColumn="dueTime">
                          要求完成时间
                          <p-sortIcon field="dueTime"></p-sortIcon>
                        </th>
                        <th style="width: 100px" pSortableColumn="creationTime">
                          创建时间
                          <p-sortIcon field="creationTime"></p-sortIcon>
                        </th>
                        <th style="width: 200px" pSortableColumn="remark">
                          备注
                          <p-sortIcon field="remark"></p-sortIcon>
                        </th>
                      </tr>
                    </ng-template>
                    <ng-template
                      pTemplate="body"
                      let-record
                      let-expanded="expanded"
                    >
                      <tr>
                        <td style="width: 100px">
                          <span class="ui-column-title"> 任务号</span>
                          {{ record.taskCode }}
                        </td>
                        <td style="width: 100px">
                          <span class="ui-column-title"> 任务名称</span>
                          {{ record.taskName }}
                        </td>
                        <td style="width: 100px">
                          <span class="ui-column-title"> 图号</span>
                          {{ record.drawingCode }}
                        </td>
                        <td style="width: 100px">
                          <span class="ui-column-title"> 型号</span>
                          {{ record.modelCode }}
                        </td>
                        <td style="width: 100px">
                          <span class="ui-column-title"> 投产数量</span>
                          {{ record.amountPlanned }}
                        </td>
                        <td style="width: 100px">
                          <span class="ui-column-title"> 节点名称</span>
                          {{ record.actName }}
                        </td>
                        <td style="width: 150px">
                          <span class="ui-column-title"> 指定人员</span>
                          {{ record.userNames }}
                        </td>
                        <td style="width: 100px">
                          <span class="ui-column-title"> 要求完成时间</span>
                          {{ record.dueTime | momentFormat: "YYYY-MM-DD" }}
                        </td>
                        <td style="width: 100px">
                          <span class="ui-column-title"> 创建时间</span>
                          {{ record.creationTime | momentFormat: "YYYY-MM-DD" }}
                        </td>
                        <td style="width: 200px">
                          <span class="ui-column-title"> 备注</span>
                          {{ record.remark }}
                        </td>
                      </tr>
                    </ng-template>
                  </p-table>
                  <div class="primeng-paging-container">
                    <p-paginator
                      rows="{{ primengTableHelper.defaultRecordsCountPerPage }}"
                      #paginator
                      (onPageChange)="getMonths($event)"
                      [totalRecords]="primengTableHelper.totalRecordsCount"
                      [rowsPerPageOptions]="
                        primengTableHelper.predefinedRecordsCountPerPage
                      "
                    >
                    </p-paginator>
                    <span class="total-records-count">
                      {{ "总计:" + primengTableHelper.totalRecordsCount }}
                    </span>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
